from calculator import Count
import unittest


# 继承TestCase
class TestCount1(unittest.TestCase):
    def setUp(self):
        print('test start')

    def test_add(self):
        j = Count(2, 3)
        self.assertEqual(j.add(), 5)

    def test_add2(self):
        j = Count(41, 76)
        self.assertEqual(j.add(), 117)

    def test_add3(self):
        j = Count(1, 1)
        self.assertEqual(j.add(), 3, msg='result is not 3')

    def test_case4(self):
        self.assertTrue(True, msg='is not true')

    def test_case5(self):
        a = 'hello'
        b = 'hello world'
        self.assertIn(a, b, msg='a noe in b')

    def tearDown(self):
        print('test end')


if __name__ == '__main__':
    # unittest.main()
    # 创建测试套件
    suite = unittest.TestSuite()
    suite.addTest(TestCount1("test_add"))
    suite.addTest(TestCount1("test_case5"))
    runner = unittest.TextTestRunner()
    runner.run(suite)
